pkgname=firmware-samsung-kminilte
pkgver=1
pkgrel=2
pkgdesc="Samsung Galaxy S5 Mini firmware"
url="https://github.com/Spookcity/android_vendor_samsung_kminilte"
arch="armv7"
license="proprietary"
options="!check !strip !archcheck !spdx !tracedeps pmb:cross-native"

_repository="android_vendor_samsung_kminilte"
_commit="987649e9667dd11bb2a2b5ec7a5f23c9037adcf5"

subpackages="$pkgname-openrc"
source="
	$pkgname-$_commit.tar.gz::https://github.com/Spookcity/$_repository/archive/$_commit.tar.gz
"

# The installed location of these files must match CONFIG_BCMDHD_FW_PATH
# and CONFIG_BCMDHD_NVRAM_PATH respectively.
# Note that "_b2" is appended to the firmware path (in drivers/net/wireless/bcmdhd/dhd_sdio.c),
# so CONFIG_BCMDHD_FW_PATH must end in ".bin", not ".bin_b2"
_files="
	proprietary/etc/wifi/bcmdhd_sta.bin_b2
	proprietary/etc/wifi/nvram_net.txt
"

package() {
	mkdir -p "$pkgdir"
	cd "$srcdir/$_repository-$_commit"
	for _f in $_files; do
		_filename=$(basename $_f)
		install -Dm644 $_f "$pkgdir"/lib/firmware/postmarketos/$_filename
	done
}

openrc() {
	install_if="$pkgname=$pkgver-r$pkgrel openrc"
	install="$subpkgname.post-install"

	mkdir -p "$subpkgdir"
}

sha512sums="
74ba0eb7e6e9c9715ba83d85fdd5e81dbca0d19a24244750471719d4c9e93cc854c2dc7585913b9d7c4f1f7b593bd57c4a38cef8ec62d543ffb2373488298bfa  firmware-samsung-kminilte-987649e9667dd11bb2a2b5ec7a5f23c9037adcf5.tar.gz
"
